<template>
	<view>
		<view>
			<view v-if="list.length>0">
				<view class="box" v-for="item in list" :key="item.name">
					<view class="title cont">
						<view class="name">{{item.name}}的请假</view>
						<view>{{item.createTime}}</view>
					</view>
					<view class="cont">所在班级：{{item.class}}</view>
					<view class="cont">请假开始时间：{{item.startTime}}</view>
					<view class="cont">请假结束时间：{{item.endTime}}</view>
					<view class="cont">申请人：{{item.parent}}</view>
					<view class="cont remark">请假事由：{{item.remark}}</view>
					<view class="cont">
					</view>
					<view v-if="item.state===0" class="btn" @click="show = true">确认</view>
				</view>
			</view>

			<u-empty text="暂无请假信息" mode="list" v-else></u-empty>
			<u-popup v-model="show" mode="center" border-radius="14" width="400rpx" height="300rpx" closeable="true">
				<view class="dialog">
					<view class="dialog_text">
						是否确认请假?
					</view>
					<view class="dialog_btn">
						<u-button type="primary" size="mini" @click="handleConfirm">确 定</u-button>
						<u-button size="mini" @click="show=false">取 消</u-button>
					</view>
				</view>
			</u-popup>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				list: [{
					name: '马嘉祺',
					createTime: '2025.02.01',
					class: '早教一般',
					startTime: '2025-02-08 8:30',
					endTime: '2025-02-08 17:30',
					parent: '定价成妈妈',
					remark: '请假11111111111111111111111111111111111111111sssssssssssssssssssssssssssssssssssssssssssssssssssddddddddddddd',
					state: 0,
				}, {
					name: '丁程鑫',
					createTime: '2025.02.01',
					class: '早教一般',
					startTime: '2025-02-08 8:30',
					endTime: '2025-02-08 17:30',
					parent: '定价成妈妈',
					remark: '请假',
					state: 1,
				}, {
					name: '宋亚轩',
					createTime: '2025.02.01',
					class: '早教一般',
					startTime: '2025-02-08 8:30',
					endTime: '2025-02-08 17:30',
					parent: '定价成妈妈',
					remark: '请假',
					state: 2,
				}]
			}
		},
		methods: {
			handleConfirm() {
				console.log('确定');
				this.show = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.dialog {
		padding: 0px 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;

		.dialog_btn {
			width: 100%;
			display: flex;
			justify-content: space-evenly;
		}

		.dialog_text {
			text-align: center;
			margin: 120rpx 0rpx 60rpx 0rpx;
		}
	}

	.box {
		background-color: #F2F2F2;
		padding: 20rpx 40rpx;
		margin: 20rpx;
		border-radius: 20rpx;
		position: relative;

		.title {
			display: flex;
			justify-content: space-between;

			.name {
				font-size: 32rpx !important;
				font-weight: bold;
			}
		}

		.cont {
			padding: 14rpx 0rpx;
			font-size: 28rpx;
		}

		.remark {
			white-space: normal;
			word-break: break-all
		}

		.btn {
			position: absolute;
			right: 20rpx;
			bottom: 20rpx;
		}
	}
</style>